<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>The Poly/ML Make System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="docstyle.css" rel="stylesheet" type="text/css">
</head>

<body>
<ul class="nav">
	<li><a href="PolyMLException.html">Previous</a></li>
	<li><a href="PolyMLStructure.html">Up</a></li>
	<li><a href="PolyMLNameSpace.html">Next</a></li>
</ul>

<h1><font SIZE="6"><a name="MakeSystem7">The Poly/ML Make System</a></font></h1>

<h2><b><font SIZE="4"><a name="Intro">Introduction</a></font></b></h2>

<p><font FACE="Courier" SIZE="3">PolyML.make</font><font SIZE="3"> is a function to help
maintain consistency of programs made up of several modules. </font><b><font FACE="Courier" SIZE="3">PolyML.make</font></b><font SIZE="3"> works on modules (files
containing functors, structures and signatures) and tries to ensure that a module is
consistent with respect to the modules it uses.</font></p>

<p><font SIZE="3">The Poly/ML compiler has two modes of operation: normal mode 
  and 'make' mode. When the compiler is operating in 'make' mode and it encounters 
  the name of a functor, structure or signature, it determines whether it is necessary 
  to remake that object from its source code.</font></p>

<p><font SIZE="3">The make system assumes that source code for functors, structures and
signatures is kept in files whose names resemble those of the objects. The variable </font><b><font FACE="Courier" SIZE="3">PolyML.suffixes</font></b><font SIZE="3"> contains the
list of filename suffixes recognised by the make system, in the order that the system
tries them. The default list is </font><font FACE="Courier" SIZE="3"><b>[&quot;&quot;,
&quot;.ML&quot;, &quot;.sml&quot;]</b></font><font SIZE="3">.</font></p>

<p><font SIZE="3">For example, if the object is called '<i>name</i>', the system 
  first tries to find a file called <em>name</em>, then tries <i>name</i>.<b>ML, 
  </b>and finally tries <i>name</i>.<b>sml </b>if neither of the other files exists. 
  Alternatively, '<i>name</i>' may be a directory containing a file called '</font><font FACE="Courier" SIZE="3"><b>ml_bind.ML</b></font><font SIZE="3">'. 
  If the make system fails to find any matching file then it assumes the object 
  is pervasive and will use the existing version of it.</font></p>

<h2><a name="Example7.4"><font SIZE="4"><b>Example</b></font></a></h2>

<p><font SIZE="3">For example, suppose we have a system in which the structure </font><b><font FACE="Courier" SIZE="3">Sort</font></b><font SIZE="3"> is created by applying the functor </font><b><font FACE="Courier" SIZE="3">SORT</font></b><font SIZE="3"> to the structures </font><b><font FACE="Courier" SIZE="3">Combinator</font></b><font SIZE="3"> and </font><b><font FACE="Courier" SIZE="3">List</font></b><font SIZE="3"> and that </font><b><font FACE="Courier" SIZE="3">Combinator</font></b><font SIZE="3"> is itself created by applying
the functor </font><b><font FACE="Courier" SIZE="3">COMBINATOR</font></b><font SIZE="3">
to the structure </font><font FACE="Courier New" SIZE="3"><b>List</b></font><font SIZE="3">.</font></p>

<p><font SIZE="3">To use the make system, we would create a directory </font><b><font FACE="Courier" SIZE="3">Sort</font></b><font SIZE="3"> with subdirectory </font><b><font FACE="Courier" SIZE="3">Sort/Combinator</font></b><font SIZE="3"> and the following files:</font></p>

<table BORDER="1" CELLSPACING="1" CELLPADDING="7" WIDTH="572">
  <tr>
    <td WIDTH="303" VALIGN="top"><font SIZE="3"><b>File</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3"><b>Contents</b></font></td>
  </tr>
  <tr>
    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/List.ML</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for structure </font><font FACE="Courier" SIZE="3"><b>List</b></font></td>
  </tr>
  <tr>
    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/Combinator/COMBINATOR.ML</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for functor </font><font FACE="Courier" SIZE="3"><b>COMBINATOR</b></font></td>
  </tr>
  <tr>
    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/Combinator/ml_bind.ML</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code to create </font><font FACE="Courier" SIZE="3"><b>Combinator</b></font></td>
  </tr>
  <tr>
    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/SORT.ML</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for functor </font><font FACE="Courier" SIZE="3"><b>SORT</b></font></td>
  </tr>
  <tr>
    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/ml_bind.ML</b></font></td>
    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code to create </font><font FACE="Courier" SIZE="3"><b>Sort</b></font></td>
  </tr>
</table>

<p><font SIZE="3">These files should have the following format:</font></p>

<p><font FACE="Courier" SIZE="3"><b>Sort/List.ML</b></font></p>

<blockquote>
  <blockquote>
    <p><font FACE="Courier" SIZE="3"><b>structure List =<br>
    struct (* body of List *) end;</b></font></p>
  </blockquote>
</blockquote>

<p><font FACE="Courier" SIZE="3"><b>Sort/Combinator/COMBINATOR.ML</b></font></p>

<blockquote>
  <blockquote>
    <p><font FACE="Courier" SIZE="3"><b>signature LSIG =<br>
    sig (* body of LSIG, as used by COMBINATOR *) end;</b></font></p>
    <p><font FACE="Courier" SIZE="3"><b>functor COMBINATOR(structure L : LSIG) =<br>
    struct (* body of COMBINATOR *) end;</b></font></p>
  </blockquote>
</blockquote>

<p><font FACE="Courier" SIZE="3"><b>Sort/Combinator/ml_bind.ML</b></font></p>

<blockquote>
  <blockquote>
    <p><font FACE="Courier" SIZE="3"><b>structure Combinator =<br>
    COMBINATOR(structure L = List);</b></font></p>
  </blockquote>
</blockquote>

<p><font FACE="Courier" SIZE="3"><b>Sort/SORT.ML</b></font></p>

<blockquote>
  <blockquote>
    <p><font FACE="Courier" SIZE="3"><b>signature CSIG =<br>
    sig (* body of CSIG *) end;</b></font></p>
    <p><font FACE="Courier" SIZE="3"><b>signature LSIG</b> <b>=<br>
    sig (* body of LSIG, as used by SORT *) end;</b></font></p>
    <p><font FACE="Courier" SIZE="3"><b>functor SORT (structure C : CSIG structure L : LSIG) =<br>
    struct<br>
    (* body of SORT *)<br>
    end;</b></font></p>
  </blockquote>
</blockquote>

<p><font FACE="Courier" SIZE="3"><b>Sort/ml_bind.ML</b></font></p>

<ul class="nav">
	<li><a href="PolyMLException.html">Previous</a></li>
	<li><a href="PolyMLStructure.html">Up</a></li>
	<li><a href="PolyMLNameSpace.html">Next</a></li>
</ul>

</body>
</html>
